package org.shuma.goods.controller;

import org.shuma.goods.commons.Result;
import org.shuma.goods.service.ProductDetailsInfoService;
import org.shuma.user.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/goods")
public class ProductDetailsInfoController {
    @Autowired
    private ProductDetailsInfoService productDetailsInfoService;
    @GetMapping("/detail")
    public Result getProductDetailsInfo(@RequestParam("productId") Integer productId,
                                        @RequestAttribute("userInfo") UserVo userVo) {
        if(userVo == null) return Result.error();
        return Result.success(productDetailsInfoService.getProductDetailsInfo(productId,userVo));
    }
}
